from typing import List


def merge(_s: str) -> str:
    temp = {}
    if _s[0] != "-":
        _s = "+" + _s

    a, b = "", ""
    i = 0
    while i < len(_s):
        while _s[i] != "X":
            a += _s[i]
            i += 1
        i += 1
        if _s[i] == "^":
            i += 1
            while i < len(_s) and _s[i] != "+" and _s[i] != "-":
                b += _s[i]
                i += 1
        if int(b) not in temp:
            temp[int(b)] = int(a)
        else:
            temp[int(b)] += int(a)
        a, b = "", ""

    array = []
    for key, value in temp.items():
        array.append([key, value])
    array.sort(key=lambda x: x[0], reverse=True)

    result = ""
    for y in array:
        if y[1] > 0:
            result = result + "+" + str(y[1]) + "X^" + str(y[0])
        else:
            result = result + str(y[1]) + "X^" + str(y[0])
    return result


if __name__ == '__main__':
    s = input().strip()

    print(merge(s))

"""
17X^4-5X^6+3X^3
"""
